package com.logansoft.zhxypkoa.components;

import java.util.Date;

import javax.servlet.http.HttpSession;

import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.rest.core.event.AbstractRepositoryEventListener;
import org.springframework.stereotype.Component;

import com.logansoft.zhxypkoa.domain.sys.Dataset;
import com.logansoft.zhxypkoa.utils.RestVerifyUtils;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Component
public class DatasetListener extends AbstractRepositoryEventListener<Dataset> {

	@Override
	protected void onBeforeCreate(Dataset entity) {
		// TODO Auto-generated method stub
		super.onBeforeCreate(entity);
		if (StringUtils.isEmpty(entity.getName())) {
			RestVerifyUtils.rejectValue(entity, "name", "name.empty", "名称不能为空");
		}
	}
}
